import { pget, ppostJson } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'

// 获取入库管理列表
export function getWarehouseinList(query?: any) {
	return pget(`${modalApi.storage}/warehousein/page`, query)
}

// 新增入库
export function addWarehousein(data: any) {
	return ppostJson(`${modalApi.storage}/warehousein/save`, data)
}

// 修改入库
export function editWarehousein(data: any) {
	return ppostJson(`${modalApi.storage}/warehousein/update`, data)
}

// 查看入库详情
export function warehouseinInfo(id: string) {
	return pget(`${modalApi.storage}/warehousein/detail/${id}`)
}

// 删除入库
export function deleteWarehousein(id: string) {
	return ppostJson(`${modalApi.storage}/warehousein/remove/${id}`)
}

// 对外车辆列表
// export function getOutCarPage(query?: any) {
// 	return pget(`${modalApi.carMessage}/vehicle/outCarPage`, query)
// }
// 对外车辆列表
export function getOutCarPage(query?: any) {
	if (window.apiPrefixUri) {
		return pget(`${window.apiPrefixUri}/mgrApi/car/car/mis/manage/outCarPage`, query)
	}
	return pget(`${modalApi.carMessage}/vehicle/outCarPage`, query)
}

/** 获取导入失败列表 */
export function getErrorListPage(query?: any) {
	return pget(`${modalApi.storage}/import/warehouse/errorListPage`, query)
}

/** 保存入库导入数据 */
export function warehouseImportData(query?: any) {
	return pget(`${modalApi.storage}/import/warehouse/importData`, query)
}
